<?php 
include($GLOBALS['PAD']."Modules/Support/Front/requests/op.req.php");
	if (isset($_POST['AddRequest']) || isset($_POST['AddArticle'])) {
	include($GLOBALS['PAD']."Modules/Support/Front/requests/requests.php");
} elseif (!isset($_POST['AddRequest']) && !isset($_POST['AddArticle'])) {
form_pr('addRequest','','?action=requests','post');
	?>
<table width="100%"  border="0" cellpadding="3" cellspacing="1">
    <tr bgcolor="#99CCCC">
      <td width="60%" bgcolor="#ACB1CC">
	  <input name="AddRequest" type="submit" id="AddRequest" value="Novo Pedido"></td>
    </tr>
</table>
</form>
<br>
<table width="100%"  border="0" cellpadding="3" cellspacing="1">
    <tr bgcolor="#ACB1CC">
      <td colspan="10">Pedidos</td>
    </tr>
  <tr bgcolor="#F2F2F2" onMouseOver="bgcolor='#FFFFFF'">
    <td width="10%" onMouseOver="bgcolor='#FFFFFF'">Referencia</td>
    <td width="10%" onMouseOver="bgcolor='#FFFFFF'">Funcionário</td>
    <td width="40%" bgcolor="#F2F2F2">ObservaÇ&otilde;es</td>
    <td width="8%">Estado</td>
    <td width="14%">Criado</td>
    <td width="14%">Entregue</td>
    <td width="14%">Aprovado</td>
  </tr>
</table>
<div id="Layer1" style="position:relative; width:100%; height:300px; z-index:1; overflow: auto;">
<?php form_pr('ConsultRequests','','edrequest.php','post'); ?>
<table width="98%"  border="0" cellpadding="3" cellspacing="1">
    <?php
	$Results = $GLOBALS['CONN']->db_array("SELECT 
					main_users.name AS RefUser,
					ccenter_requests.Ref,
					ccenter_requests.Observations,
					hcce_status.name AS Status,
					ccenter_requests.TimeCreated,
					ccenter_requests.TimeDelivered,
					ccenter_requests.RefSupervisor
				FROM ccenter_requests
				INNER JOIN main_users ON main_users.ref = RefUser
				INNER JOIN hcce_status ON hcce_status.ref = ccenter_requests.Status
				WHERE RefOffice = {$_SESSION['office']}
				AND Status > 0
				ORDER BY ccenter_requests.TimeCreated DESC"); 
	for ($f = 1; $f <= $Results[0]; $f++) { 
	
		echo '<tr bgcolor="#D3D6E4">
		<td width="10%"><a href="?action='.$Results[$f]['Ref'].'">'.$Results[$f]['Ref'].'</a></td>
		<td width="10%">'.$Results[$f]['RefUser'].'</td>
		<td width="40%">'.$Results[$f]['Observations'].'</td>
		<td width="8%">'.$Results[$f]['Status'].'</td>
		<td width="14%">'.$Results[$f]['TimeCreated'].'</td>
		<td width="14%">'.$Results[$f]['TimeDelivered'].'</td>
		<td width="14%">'.$Results[$f]['RefSupervisor'].'</td>
		</tr>';
   }
  } ?>
  </table>
 </form>
</div>